﻿Public Class Senha
    Dim objBBL As New BLLUsuario


    Sub limpa()
        txtsenhaantiga.Text = ""
        txtsenhaatual.Text = ""
        txtconfirmasenha.Text = ""
    End Sub


    Private Sub bcancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bcancelar.Click
        limpa()
        fMenu.Show()
        Me.Hide()

    End Sub

    Private Sub balterar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles balterar.Click
        Try
            If (MessageBox.Show("Confirma Alteração ?", "", MessageBoxButtons.YesNo) = vbYes) Then
                If (txtconfirmasenha.Text <> "" And txtsenhaantiga.Text <> "" And txtsenhaatual.Text <> "") Then
                    Dim resultado As Boolean
                    objBBL.psenha = txtsenhaatual.Text
                    objBBL.plogin = frmLogin.logado
                    resultado = objBBL.AlterarSenha(txtsenhaantiga.Text)
                    If resultado = True Then
                        MessageBox.Show("Senha Alterada com Sucesso!!")
                        limpa()
                    Else
                        MessageBox.Show("Dados Inválido")
                    End If
                Else
                    MessageBox.Show("Favor Preencher Todos os Campos")
                End If
            End If

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub Senha_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class